<!-- template inhertance -->
<extend name="layout/layui24"/>

<!-- styles -->
<block name="linkcss">
    <style>
        .layui-form .table tbody tr td {
            padding: 0 !important;
            vertical-align: middle;
            height: 45px;
        }
        .layui-form .table tbody tr td:nth-child(2n+1) {
            font-weight: 600;
        }
        .layui-form .table tbody tr td .layui-input,.layui-textarea,select {
            border: 1px solid transparent;
            height: 45px;
        }
        .layui-form .table tbody tr td .layui-input:focus,
        .layui-form .table tbody tr td .layui-textarea:focus,
        .layui-form .table tbody tr td select:focus,
        .layui-form .table tbody tr td .layui-input:hover,
        .layui-form .table tbody tr td .layui-textarea:hover,
        .layui-form .table tbody tr td select:hover {
            border: 1px solid #009688 !important;
        }
        .ti-10 {
            text-indent: 10px;
        }
    </style>
</block>

<!-- scripts -->
<block name="linkjs">

</block>

<!-- page title -->
<block name="webtitle">
    <title>添加客户</title>
</block>

<!-- navagations -->
<block name="breadcrumb">
    <ol class="breadcrumb breadcrumb-edit">
        <li><a href="customersIndex">客户信息</a></li>
        <li class="active">添加客户</li>
    </ol>
</block>

<!-- main body -->
<block name="content">
    <form action="" class="layui-form" autocomplete="off">
        <div class="section-grey-table">
            <div class="section-title">基本资料</div>
            <div class="section-body">
                <table class="table table-bordered">
                    <colgroup>
                        <col width="140">
                        <col>
                        <col width="140">
                        <col>
                    </colgroup>
                    <tbody>
                    <tr>
                    <tr>
                        <td class="ti-10">客户编号</td>
                        <td colspan="3">
                            <input type="text" name="no" class="layui-input" lay-verify="required" placeholder="客户编号">
                        </td>
                    </tr>
                        <td class="ti-10">客户简称</td>
                        <td>
                            <input type="text" name="customer" class="layui-input" lay-verify="required" placeholder="客户简称">
                        </td>
                        <td class="ti-10">客户全称</td>
                        <td>
                            <input type="text" name="full_name" class="layui-input" lay-verify="required" placeholder="客户全称">
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">客户地址</td>
                        <td colspan="3">
                            <input type="text" name="bill_to" class="layui-input" lay-verify="required" placeholder="客户地址">
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">收货地址</td>
                        <td colspan="3">
                            <input type="text" name="ship_to" class="layui-input" lay-verify="required" placeholder="收货地址">
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">联系人</td>
                        <td>
                            <input type="text" name="atten" class="layui-input" lay-verify="required" placeholder="客户联系人">
                        </td>
                        <td class="ti-10">电话</td>
                        <td>
                            <input type="text" name="tel" class="layui-input" lay-verify="required" placeholder="联系人电话">
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">传真</td>
                        <td>
                            <input type="text" name="fax" class="layui-input" placeholder="联系人传真">
                        </td>
                        <td class="ti-10">邮箱</td>
                        <td>
                            <input type="text" name="email" class="layui-input" lay-verify="required|email" placeholder="联系人邮箱">
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">客户账期</td>
                        <td colspan="3">
                            <select name="peyment_term" lay-verify="required">
                                <option value=""></option>
                                <option value="Wire Transfer">Wire Transfer</option>
                                <option value="Net 15">Net 15</option>
                                <option value="Net 30">Net 30</option>
                                <option value="Net 45">Net 45</option>
                                <option value="Net 60">Net 60</option>
                                <option value="Net 90">Net 90</option>
                                <option value="L/C">L/C</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="ti-10">备注</td>
                        <td colspan="3">
                            <textarea name="remark" class="layui-textarea" placeholder="备注"></textarea>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!--按钮-->
        <div class="layui-form-item">
            <button type="button" class="layui-btn" lay-submit lay-filter="save">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
</block>

<block name="scripts">
    <script>
        $(function () {
            layui.use('form',function() {
                var form = layui.form;

                //监听保存
                form.on('submit(save)',function(data) {
                    console.log(data.field);
                    $.post("", data.field, function (response) {
                        if (response.code) {
                            layer.msg(response.msg, {icon: 2});
                        } else {
                            //do something保存为草稿到详情页
                            // location.href = '';
                        }
                    })
                })
            })
        })
    </script>
</block>